﻿#region Copyright
// Copyright (c) 2011-2012 RaisingForce Team (Alikin Sergey)
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion

using System;
using RaisingForce.Raise.Presentation.ViewModel;

namespace RaisingForce.RaiseHardwareTest.ViewModel
{
    sealed internal class MainVisibilityViewModel :
        ViewModelBase
    {
        #region Constructors

        public MainVisibilityViewModel()
            : base()
        { }

        #endregion

        #region Base Overrides

        protected override void OnPropertyChanged(string propertyName)
        {
            base.OnPropertyChanged(propertyName);
            switch (propertyName)
            {
                case propCommandsAreHidden:
                case propLabeledCommandsAreHidden:
                    this.OnVisibilityChanged();
                    break;
            }
        }

        #endregion

        #region ViewModel Properties

        private bool commandsAreHidden = true;

        private const string propCommandsAreHidden = "CommandsAreHidden";

        public bool CommandsAreHidden
        {
            get { return this.commandsAreHidden; }
            set
            {
                this.SetProperty(
                    ref this.commandsAreHidden,
                    value,
                    propCommandsAreHidden);
            }
        }

        private bool labeledCommandsAreHidden = true;

        private const string propLabeledCommandsAreHidden = "LabeledCommandsAreHidden";

        public bool LabeledCommandsAreHidden
        {
            get { return this.labeledCommandsAreHidden; }
            set
            {
                this.SetProperty(
                    ref this.labeledCommandsAreHidden,
                    value,
                    propLabeledCommandsAreHidden);
            }
        }


        #endregion

        #region VisibilityChanged Event

        public event EventHandler VisibilityChanged;

        private void OnVisibilityChanged()
        {
            this.OnEvent(this.VisibilityChanged);
        }

        #endregion
    }
}
